
package com.lzb.watermarkcamera.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.watermarkcamera.R;
import com.lzb.watermarkcamera.basic.ProviderMultiAdapter;
import com.lzb.watermarkcamera.bean.CutBean;

public class CropAdapter extends ProviderMultiAdapter<CutBean> {

    public CropAdapter() {
        addItemProvider(new CropProvider());
    }

    private class CropProvider extends BaseItemProvider<CutBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_crop;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, CutBean bean) {
            baseViewHolder.setText(R.id.tvCropItemName, bean.getName());
            if (bean.isSelect()) {
                baseViewHolder.setTextColor(R.id.tvCropItemName, Color.parseColor("#664DE8"));
            } else {
                baseViewHolder.setTextColor(R.id.tvCropItemName, Color.parseColor("#FFFFFF"));
            }
        }
    }
}
